import vueRouter from "vue-router";
import Vue from "vue";
/*import Login from "@/views/login/index.vue";
import Admin from "@/components/admin/index.vue";
import Artis from '@/components/music/artistList.vue'
import AlbumList from "@/components/music/albumList.vue";
import MusicList from "@/components/music/musicList.vue";
import AdvertisementConfig from "@/components/splash/advertisementConfig.vue";
import CarouselConfig from "@/components/splash/carouselConfig.vue";
import Home from "@/views/home/index.vue";*/

const Login=()=>import('@/views/login/index.vue')
const Admin=()=>import('@/components/admin/index.vue')
const Artis =()=>import('@/components/music/artistList.vue')
const AlbumList =()=>import('@/components/music/albumList.vue')
const MusicList =()=>import('@/components/music/musicList.vue')
const AdvertisementConfig =()=>import('@/components/splash/advertisementConfig.vue')
const CarouselConfig =()=>import('@/components/splash/carouselConfig.vue')
const Home =()=>import('@/views/home/index.vue')
const error=()=>import('@/views/layout/error.vue')

// 使用vueRouter
Vue.use(vueRouter)

// 路由表
const menuRouter=[
    {path: '/admin', component: Admin},
    {path: '/artis', component: Artis},
    {path: '/album', component: AlbumList},
    {path: '/music', component: MusicList},
    {path: '/advertisement', component: AdvertisementConfig},
    {path: '/carousel', component: CarouselConfig},

]

// 注册路由表
const routes = [
    {path: '/login', component: Login},
    {
        path: '/', name: '', component: Home,
        redirect:menuRouter[0].path,
        children: menuRouter
    },
    {path: '*', component: error},
]

// 路由实例化
const router = new vueRouter({
    routes
})

// 默认暴露router对象
export default router;
